package ejb.dao;

import ejb.entities.Event;
import ejb.entities.WeatherForecast;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Stateless;

@Stateless
public class WeatherDAO extends GenericDAO<WeatherForecast>{

    public WeatherDAO() {
        super(WeatherForecast.class);
    }
    
    public WeatherForecast findWeatherById(int idWeather) {
		Map<String, Object> parameters = new HashMap<>();
		parameters.put("idwea", idWeather);
		String query = "select u from weather u where u.idWeather = :idwea";
		return super.findOneResult(query, parameters);
	}     
    
    public List<WeatherForecast> findInvitationByEvent(Event evented) {
		Map<String, Object> parameters = new HashMap<>();
		parameters.put("event", evented);
		String query = "select u from weather u where u.event = :event";
		return super.findManyResult(query, parameters);
	}
    
}
